package com.attendance.www.hr.timer;

import java.util.Calendar;
import java.util.Date;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.attendance.www.hr.service.IAttendanceReportService;

@Service
public class AttendanceReportTimer {
	
	@Resource
	private IAttendanceReportService attendanceReportService;
	
	/**
	 * 每日生成考勤报表数据
	 */
	public void generateAttendanceReport() {
		//获取昨天考勤信息
		Calendar cal=Calendar.getInstance();
		cal.set(Calendar.HOUR_OF_DAY,0);
		cal.set(Calendar.MINUTE,0);
		cal.set(Calendar.SECOND,0);
		cal.set(Calendar.MILLISECOND,0);
		Date startDate=cal.getTime();
		Date endDate=cal.getTime();
		//生成一天数据
//      attendanceReportService.saveAttendanceReport(startDate, endDate, null);
		//循环生成指定天数的数据
		attendanceReportService.saveAttendanceReportMonth(startDate);
	}
}
